package com.ibeeking.found.id.rest.redis;
import java.time.format.DateTimeFormatter;

/**
 * @author hao
 */
public class SimpleDateFormatter {
    public static final String YYYY = "yyyy";
    public static final String YYYY_MM = "yyyyMM";
    public static final String YYYY_MM_DD = "yyyyMMdd";
    public static final String YYYY_MM_DD_HH_MM_SS = "yyyyMMddHHmmss";
    public static final String YYYY_MM_DD_HH_MM_SS_SSS = "yyyyMMddHHmmssSSS";
    public static String[] parsePatterns = {YYYY, YYYY_MM, YYYY_MM_DD, YYYY_MM_DD_HH_MM_SS, YYYY_MM_DD_HH_MM_SS_SSS};
    public static final DateTimeFormatter FORMATTER_YEAR = DateTimeFormatter.ofPattern(YYYY);
    public static final DateTimeFormatter FORMATTER_MONTH = DateTimeFormatter.ofPattern(YYYY_MM);
    public static final DateTimeFormatter FORMATTER_DAY = DateTimeFormatter.ofPattern(YYYY_MM_DD);
    public static final DateTimeFormatter FORMATTER_SECOND = DateTimeFormatter.ofPattern(YYYY_MM_DD_HH_MM_SS);
    public static final DateTimeFormatter FORMATTER_MILLISECOND = DateTimeFormatter.ofPattern(YYYY_MM_DD_HH_MM_SS_SSS);

    public static final DateTimeFormatter formatter(String pattern) {
        return DateTimeFormatter.ofPattern(pattern);
    }
}
